<?php

/**
* Texyla script loader
* Includes all Texyla scripts to one file
* zakomentujte ty pluginy, které nechcete nahrát.
*/

header('Content-Type: text/javascript; charset=utf-8');
$jQuery = array(
	'jquery',
	'jquery.ui',
	'ajaxfileupload',
	'jquery.collapsor',
);

$core = array(
	// jádro texyly
	'texyla',
	'selection',
	'texy',
	'buttons',
	'dom',
	'view',
);


$plugins = array(
	'emoticon',
	'file-browser',
	'file-upload',
	'img',
	'img-upload',
	'img-gallery',
	'keys',
	'link',
	'resizable-textarea',
	'symbol',
	'table',
	'window',	
);

function loadTexyla($dir, $names, $subDir = 0) {
	$root = dirname(__FILE__) . '/' . $dir . '/';
	$t = '';
	if (is_array($names)) {
		foreach ($names as $name) {
			$path = ($subDir === 0 ? $name : "$name/$name") . '.js';
			$file = $root . $path;
			if (file_exists($file)) {
				$t .= "\n\n\n\n/** " . $file . "*/\n" . file_get_contents($file);
			}
		}
	}
	echo $t;
}

loadTexyla('../jquery', $jQuery);
loadTexyla('js', $core);
loadTexyla('plugins', $plugins, 1);
loadTexyla('languages', array('cs'));

?>
